#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
 
my $ua = LWP::UserAgent->new;

#my $request = HTTP::Request->new(GET => 'http://192.168.0.198/alab/rest_api.cgi',[foo=>1,bar=>'hoge']);#my $request = HTTP::Request->new(PUT => 'http://192.168.0.198/alab/rest_api.cgi',[foo=>1,bar=>'hoge']);
#my $request = HTTP::Request->new(POST => 'http://192.168.0.198/alab/rest_api.cgi');
my $request = HTTP::Request->new(GET => 'http://127.0.0.1/');

#my $request = HTTP::Request->new(DELETE => 'http://192.168.0.198/alab/rest_api.cgi');
#my $request = HTTP::Request->new(PUT => 'http://192.168.0.198/alab/rest_api.cgi');
#my $request = HTTP::Request->new(POST => 'http://192.168.0.198/alab/rest_api.cgi',[foo=>1,bar=>'hoge']);
#$request->content('foo=9&bar=www');

#my $response = $ua->post('http://192.168.0.198/alab/rest_api.cgi');
my $response = $ua->request($request);

# method:ok partam:ng
#my $response = $ua->request(PUT 'http://192.168.0.198/alab/rest_api.cgi',[foo=>1,bar=>'hoge']);

# OK
#my $response = $ua->request(POST 'http://192.168.0.198/alab/rest_api.cgi',[foo=>1,bar=>'hoge']);

## NG
##my $response = $ua->request(DELETE 'http://192.168.0.198/alab/rest_api.cgi');
if ($response->is_success) {
    print $response->content;  # or whatever
}



